package com.itheima.controller;


import com.itheima.common.R;
import com.itheima.domain.SetmealDishes;
import com.itheima.domain.vo.SetmealVo;
import com.itheima.service.SetmealDishesService;
import com.itheima.service.SetmealService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/setmeal")
public class SetmealControllerClient {

    @Autowired
    private SetmealService setmealService;


    @Autowired
    private SetmealDishesService setmealDishesService;


    @GetMapping("/list")
    public R<List<SetmealVo>> categoryList(@RequestParam(value = "categoryId" ,required = false) String categoryId, @RequestParam(value = "name",required = false) String name ){
        log.info("显示套餐列表：categoryId={} name={}", categoryId, name);
        return setmealService.clientCategoryList(categoryId, name);

    }

    @GetMapping("/dish/{id}")
    public R<List<SetmealDishes>> selectById(@PathVariable String id){
        log.info("查询套餐中菜品详情id={}", id);
        return setmealService.clientSelectSetmealDishesById(id);
    }























}
